﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    mc:Ignorable="d"
    x:Class="BioPatMLEditor.PatternTemplatesPanel">

    <Grid
        x:Name="LayoutRoot"
        Width="250"
        Height="500"
        MinWidth="200"
        MinHeight="200">
        <Border
            CornerRadius="5"
            Height="25"
            VerticalAlignment="Top"
            Margin="5,5,10,5"
            d:LayoutOverrides="VerticalAlignment">
            <Border.Background>
                <SolidColorBrush
                    Color="{StaticResource BorderColor1}" />
            </Border.Background>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="208*" />
                    <ColumnDefinition
                        Width="25*" />
                </Grid.ColumnDefinitions>
                <TextBlock
                    Text="Pattern Templates"
                    TextWrapping="Wrap"
                    FontSize="13.333"
                    FontWeight="Bold"
                    FontStyle="Italic"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Left"
                    Margin="5,5,0,5"
                    Foreground="White" />
                <Button
                    HorizontalAlignment="Center"
                    x:Name="CloseBtn"
                    VerticalAlignment="Center"
                    Grid.Column="1"
                    Width="15"
                    Height="15" 
                    ToolTipService.ToolTip="Close panel"
                    Click="CloseBtn_Click" />
            </Grid>

        </Border>
        <Border
            BorderThickness="3"
            CornerRadius="5"
            Margin="5,40,10,10"
            Padding="5">
            <Border.BorderBrush>
                <SolidColorBrush
                    Color="{StaticResource BorderColor1}" />
            </Border.BorderBrush>
            <Border
                Margin="5"
                CornerRadius="5">
                <ScrollViewer
                    HorizontalScrollBarVisibility="Auto"
                    VerticalScrollBarVisibility="Auto"
                    Grid.Column="1"
                    HorizontalAlignment="Stretch"
                    Width="215" BorderBrush="{x:Null}">
                    <Grid
                        Width="auto"
                        Height="auto">
                        <!-- We define our grid resource now, they are mainly the codes for fading in/out for our expander control -->
                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="auto" />
                            <RowDefinition
                                Height="auto" />
                            <RowDefinition
                                Height="auto" />
                            <RowDefinition
                                Height="auto" />
                        </Grid.RowDefinitions>

                    	<i:Interaction.Behaviors>
                    		<ei:FluidMoveBehavior Duration="0:0:0.5" AppliesTo="Children">
                    			<ei:FluidMoveBehavior.EaseY>
                    				<CircleEase EasingMode="EaseInOut"/>
                    			</ei:FluidMoveBehavior.EaseY>
                    			<ei:FluidMoveBehavior.EaseX>
                    				<CircleEase EasingMode="EaseInOut"/>
                    			</ei:FluidMoveBehavior.EaseX>
                    		</ei:FluidMoveBehavior>
                    	</i:Interaction.Behaviors>

                        <toolkit:Expander
                            Grid.Column="0"
                            Grid.Row="0"
                            ExpandDirection="Down"
                            Header="Regional Patterns"
                            IsExpanded="False" Style="{StaticResource ExpanderStyle1}">
                            <toolkit:Expander.Foreground>
                                <SolidColorBrush
                                    Color="{StaticResource TextForegroundColor1}" />
                            </toolkit:Expander.Foreground>

                            <toolkit:ListBoxDragDropTarget
                                AllowDrop="false"
                                VerticalAlignment="Top"
                                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                BorderThickness="0"
                                Width="170">
                                <ListBox
                                    x:Name="listBoxRegionalPatternMenu"
                                    Width="170"
                                    BorderBrush="{x:Null}">

                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border
                                                BorderThickness="1"
                                                Width="150"
                                                CornerRadius="5">
                                                <StackPanel
                                                    Orientation="Horizontal">
                                                    <TextBlock
                                                        Text="{Binding ElementName}"
                                                        Margin="5,0,0,0" />
                                                </StackPanel>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </toolkit:ListBoxDragDropTarget>
                        </toolkit:Expander>

                        <toolkit:Expander
                            Grid.Row="1"
                            ExpandDirection="Down"
                            Header="Simple Patterns" Style="{StaticResource ExpanderStyle1}">
                            <toolkit:Expander.Foreground>
                                <SolidColorBrush
                                    Color="{StaticResource TextForegroundColor1}" />
                            </toolkit:Expander.Foreground>
                            <!-- End recursive pattern -->
                            <!-- Recursive patterns menu -->
                            <toolkit:ListBoxDragDropTarget
                                AllowDrop="false"
                                VerticalAlignment="Top"
                                BorderThickness="0"
                                Width="170">
                                <ListBox
                                    x:Name="listBoxRecursivePatternMenu"
                                    Width="170"
                                    BorderBrush="{x:Null}">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border
                                                BorderThickness="1"
                                                Width="150"
                                                CornerRadius="5">
                                                <StackPanel
                                                    Orientation="Horizontal">
                                                    <TextBlock
                                                        Text="{Binding ElementName}"
                                                        Margin="5,0,0,0" />
                                                </StackPanel>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </toolkit:ListBoxDragDropTarget>

                        </toolkit:Expander>

                        <toolkit:Expander
                            Grid.Row="2"
                            ExpandDirection="Down"
                            Header="Structured Patterns" Style="{StaticResource ExpanderStyle1}">
                            <toolkit:Expander.Foreground>
                                <SolidColorBrush
                                    Color="{StaticResource TextForegroundColor1}" />
                            </toolkit:Expander.Foreground>
                            <!-- End structured pattern -->
                            <!-- Structured patterns menu -->
                            <toolkit:ListBoxDragDropTarget
                                AllowDrop="false"
                                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                VerticalAlignment="Top"
                                BorderThickness="0"
                                Width="170">
                                <ListBox
                                    x:Name="listBoxStructuredPatternMenu"
                                    Width="170"
                                    BorderBrush="{x:Null}">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border
                                                BorderThickness="1"
                                                Width="150"
                                                CornerRadius="5">
                                                <StackPanel
                                                    Orientation="Horizontal">
                                                    <TextBlock
                                                        Text="{Binding ElementName}"
                                                        Margin="5,0,0,0" />
                                                </StackPanel>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </toolkit:ListBoxDragDropTarget>
                        </toolkit:Expander>

                        <toolkit:Expander
                            Grid.Row="3"
                            IsExpanded="False"
                            ExpandDirection="Down"
                            Header="Special Patterns" Style="{StaticResource ExpanderStyle1}">
                            <toolkit:Expander.Foreground>
                                <SolidColorBrush
                                    Color="{StaticResource TextForegroundColor1}" />
                            </toolkit:Expander.Foreground>
                            <!-- End special pattern -->
                            <!-- Special patterns menu -->
                            <toolkit:ListBoxDragDropTarget
                                AllowDrop="false"
                                Margin="5,0,0,0"
                                VerticalAlignment="Top"
                                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                BorderThickness="0"
                                Width="170">
                                <ListBox
                                    x:Name="listBoxSpecialPatternMenu"
                                    Width="170"
                                    BorderBrush="{x:Null}">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border
                                                BorderThickness="1"
                                                Width="150"
                                                CornerRadius="5">
                                                <StackPanel
                                                    Orientation="Horizontal">
                                                    <TextBlock
                                                        Text="{Binding ElementName}"
                                                        Margin="5,0,0,0" />
                                                </StackPanel>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </toolkit:ListBoxDragDropTarget>
                        </toolkit:Expander>
                    </Grid>
                </ScrollViewer>

            </Border>

        </Border>
        <Thumb
            x:Name="resizeRight"
            HorizontalAlignment="Right"
            Width="5"
            Cursor="SizeWE"
            DragDelta="resizeRight_DragDelta"
            d:LayoutOverrides="GridBox"
            Template="{StaticResource VerticalThumbTemplate}" />
        <Thumb
            x:Name="resizeDown"
            Cursor="SizeNS"
            Height="5"
            VerticalAlignment="Bottom"
            d:LayoutOverrides="Width, GridBox"
            Template="{StaticResource HorizontalThumbTemplate}"
            DragDelta="resizeDown_DragDelta" />
    </Grid>
</UserControl>